package com.example.contact_recover;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;

public class WebVActivity extends AppCompatActivity {

    private EditText edit_url;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_v);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        WebView web = findViewById(R.id.web_v);
        WebSettings settings = web.getSettings();
        settings.setJavaScriptEnabled(true);



        // 加载的是自己的网页
        web.loadUrl("https://www.neecola.com");

        edit_url = findViewById(R.id.edit_url);

        Button btn_goto_url = findViewById(R.id.btn_go_to_web);

        btn_goto_url.setOnClickListener(((v -> {
            String s = edit_url.getText().toString();
            web.loadUrl(s);
        })));


    }

}
